-
Notifications
You must be signed in to change notification settings - Fork 51
Tests: fix tests if running with self-built ffmpeg #812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
If self-building ffmpeg from the tag for development reasons, it's version is set as `n6.1.2` (with n-prefix). This causes failures in the torchcodec tests. This patch handles such a case accounting for the `n6.1.2` ffmpeg version format. Co-authored-by: Dmitry Rogozhkin <[email protected]> Signed-off-by: Edgar Romo Montiel <[email protected]>
@eromomon, linter is likely giving the rightful issue:
Please, see https://github.com/pytorch/torchcodec/blob/main/CONTRIBUTING.md#code-formatting-and-type-checking on how to run linter locally. I think MacOS issue might not be related to your change. Let's see linter issue fixed first. |
Thanks for the PR @eromomon . I tried to push this directly but it seems I don't have permission to push on your branch. Could you please apply this patch, which adds a few comments? Then it should be good to merge. Thanks! diff --git a/src/torchcodec/_core/custom_ops.cpp b/src/torchcodec/_core/custom_ops.cpp
index daec201..0e446a2 100644
--- a/src/torchcodec/_core/custom_ops.cpp
+++ b/src/torchcodec/_core/custom_ops.cpp
@@ -656,6 +656,10 @@ std::string get_stream_json_metadata(
// Returns version information about the various FFMPEG libraries that are
// loaded in the program's address space.
+// TODO: ideally we'd have a more robust way of getting the ffmpeg version,
+// we're using av_version_info() which is not standardized and shouldn't be
+// parsed by code (which we do!). See
+// https://github.com/pytorch/torchcodec/issues/100
std::string _get_json_ffmpeg_library_versions() {
std::stringstream ss;
ss << "{\n";
diff --git a/test/utils.py b/test/utils.py
index 517100e..c258ac4 100644
--- a/test/utils.py
+++ b/test/utils.py
@@ -29,6 +29,9 @@ def cpu_and_cuda():
def get_ffmpeg_major_version():
ffmpeg_version = get_ffmpeg_library_versions()["ffmpeg_version"]
+ # When building FFmpeg from source there can be a `n` prefix in the version
+ # string. This is quite brittle as we're using av_version_info(), which has
+ # no stable format. See https://github.com/pytorch/torchcodec/issues/100
if ffmpeg_version.startswith("n"):
ffmpeg_version = ffmpeg_version.removeprefix("n")
return int(ffmpeg_version.split(".")[0]) |
and src/torchcodec/_core/custom_ops.cpp files Co-authored-by: Nicolas Hug <[email protected]> Signed-off-by: Edgar Romo Montiel <[email protected]>
Thank you for your feedback, @NicolasHug, I have updated the files to incorporate the mentioned comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @eromomon !
If self-building ffmpeg from the tag for development reasons, it's version is set as
n6.1.2
(with n-prefix). This causes failures in the torchcodec tests. This patch handles such a case accounting for then6.1.2
ffmpeg version format.CC: @scotts, @NicolasHug, @dvrogozh